/*
Copyright (C) 2010 
Author		  Oliver Schenk
Contact		  Oliver.Schenk76@gmail.com

This program is free software; you can redistribute
it and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 3 of the License,
or (at your option) any later version.
This program is distributed in the hope that it will be useful, 
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; 
if not, see <http://www.gnu.org/licenses/>.
*/

package SelfBookingSystem.MyFramework;
import java.util.logging.Logger;

public class HTMLFormGenerator {
	private static final Logger log = Logger.getLogger(HTMLFormGenerator.class.getName());
	//Konstruktor setzt Instanzenvariablen auf Defaultwert
    public HTMLFormGenerator(){

    	//Empty Constructor
    }
    
    public String FormOpen(String action, String onsubmit, String method){
    	String Element = "";
    	Element += "<form ";
    	Element += "action=\"" + action + "\" ";
    	if(onsubmit != null) Element += "onsubmit=\"" + onsubmit + "\" ";
    	if(method != null) Element += "method=\"" + method + "\" ";
    	Element += ">";
    	return Element;
    }
    
    public String TextElement(String Name, String Size, String MaxLength, String Value){
    	String Element = "";
    	Element += "<input type=\"text\" ";
    	Element += "name=\"" + Name +  "\" ";
    	if(Size != null)	Element += "size=\"" + Size +  "\" ";
    	if(MaxLength != null) Element += "maxlength=\"" + MaxLength +  "\" ";
    	if(Value != null) Element += "value=\"" + Value +  "\"";
    	Element += ">";
    	log.info("LogTest Info");
    	log.warning("LogTest Warning");
    	return Element;
    }

    public String HiddenElement(String Name, String Value){
    	String Element = "";
    	Element += "<input type=\"hidden\" ";
    	Element += "name=\"" + Name +  "\" ";
    	Element += "value=\"" + Value +  "\"";
    	Element += ">";
    	return Element;
    }

    public String FormSubmit(String value){
    	String Element = "";
    	Element += "<input type=\"submit\" ";
    	Element += "value=\"" + value + "\" ";
    	Element += ">";
    	return Element;
    }
    
    public String FormClose(){
    	String Element = "";
    	Element += "</form>";
    	return Element;
    }
    
	
}
